import React, { useEffect } from 'react'
import * as echarts from 'echarts'

const Echarts = () => {
  useEffect(() => {
    createEcharts()
  }, [])
  const createEcharts = () => {
    let chartDom = document.getElementById('contion')
    let myChart = echarts.init(chartDom)
    let option

    option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      },
      yAxis: {
        type: 'value',
      },
      series: [
        {
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'line',
        },
      ],
    }

    option && myChart.setOption(option)
  }
  return <div id="contion" style={{ width: 500, height: 500 }}></div>
}

export default Echarts
